package cc.mrbird.febs.power.controller;


import cc.mrbird.febs.common.utils.R;
import cc.mrbird.febs.power.entity.AccountExtendInfo;
import cc.mrbird.febs.power.service.IAccountExtendInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author MrBird
 */
@RestController
@RequestMapping("/power/account-extend-info")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AccountExtendInfoController {

    private final IAccountExtendInfoService iAccountExtendInfoService;

    /**
     * 新增账户
     * @param accountExtendInfo
     * @return
     */
    @PostMapping("/AccountExtendInfoAdd")
    public R AccountExtendInfoAdd(AccountExtendInfo accountExtendInfo) {
        return R.ok(iAccountExtendInfoService.save(accountExtendInfo));
    }

    /**
     * 修改账户
     * @param accountExtendInfo
     * @return
     */
    @PutMapping("/AccountExtendInfoEdit")
    public R AccountExtendInfoEdit(AccountExtendInfo accountExtendInfo) {
        return R.ok(iAccountExtendInfoService.updateById(accountExtendInfo));
    }

    /**
     * 根据ID删除记录
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public R AccountExtendInfoDel(@PathVariable Integer id) {
        return R.ok(iAccountExtendInfoService.removeById(id));
    }
}
